 function Player (){}
 Player.isIOS = (function() {
    if (/iPhone/i.test(navigator.userAgent) || /iPad/i.test(navigator.userAgent)) {
        return true
    }
    return false
})();
Player.isWeiXin = function() {
    if (/MicroMessenger/i.test(navigator.userAgent)) {
        return true
    } else {
        return false
    }
};
Player.audioAutoPlay = function(d, g, c) {
	var b = false;
	if (!window.wx || !Player.isWeiXin()) {
		_audioPlay(d);
		g && g();
		c && c();
		return
	}
	var a;
	try {
		a = setInterval(function() {
			if (document.readyState == "complete") {
				clearInterval(a);
				wx.ready(function() {
					_audioPlay(d);
					c && c();
					if (!b) {
						b = true;
						if (Player.isIOS) {
							d.oncanplay = function() {
								g && g()
							}
						} else {
							g && g()
						}
					}
				});
				wx.checkJsApi({
					jsApiList: ["checkJsApi"],
					success: function() {
						_audioPlay(d);
						c && c();
						if (!b) {
							b = true;
							if (Player.isIOS) {
								d.oncanplay = function() {
									g && g()
								}
							} else {
								g && g()
							}
						}
					},
				})
			}
		}, 100)
	} catch (f) {
		clearInterval(a)
	}
}

function _audioPlay(a) {
    if (!a) {
        return
    }
    var b = a.play();
    if (b && b["catch"]) {
        b["catch"](function(c) {})
    }
}
